import { Message } from "../model/Result";

enum RetCode {
  SUC = 200,
  FAIL = -1,
}

function init() {
  const success = (data: any): Message => {
    return {
      code: RetCode.SUC,
      data,
    };
  };

  const fail = (data: any, code = RetCode.FAIL) => {
    return {
      code,
      data,
    };
  };
  return {
    success,
    fail,
  };
}
export const Result = init();
